package com.ruoyi.gybj.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.gybj.domain.PlatformInfo;
import com.ruoyi.gybj.service.IPlatformInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 装卸台信息Controller
 * 
 * @author ruoyi
 * @date 2025-11-19
 */
@RestController
@RequestMapping("/basic/platform")
public class PlatformInfoController extends BaseController
{
    @Autowired
    private IPlatformInfoService platformInfoService;

    /**
     * 查询装卸台信息列表
     */
    @PreAuthorize("@ss.hasPermi('basic:platform:list')")
    @GetMapping("/list")
    public TableDataInfo list(PlatformInfo platformInfo)
    {
        startPage();
        List<PlatformInfo> list = platformInfoService.selectPlatformInfoList(platformInfo);
        return getDataTable(list);
    }

    /**
     * 导出装卸台信息列表
     */
    @PreAuthorize("@ss.hasPermi('basic:platform:export')")
    @Log(title = "装卸台信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PlatformInfo platformInfo)
    {
        List<PlatformInfo> list = platformInfoService.selectPlatformInfoList(platformInfo);
        ExcelUtil<PlatformInfo> util = new ExcelUtil<PlatformInfo>(PlatformInfo.class);
        util.exportExcel(response, list, "装卸台信息数据");
    }

    /**
     * 获取装卸台信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('basic:platform:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(platformInfoService.selectPlatformInfoById(id));
    }

    /**
     * 新增装卸台信息
     */
    @PreAuthorize("@ss.hasPermi('basic:platform:add')")
    @Log(title = "装卸台信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PlatformInfo platformInfo)
    {
        return toAjax(platformInfoService.insertPlatformInfo(platformInfo));
    }

    /**
     * 修改装卸台信息
     */
    @PreAuthorize("@ss.hasPermi('basic:platform:edit')")
    @Log(title = "装卸台信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PlatformInfo platformInfo)
    {
        return toAjax(platformInfoService.updatePlatformInfo(platformInfo));
    }

    /**
     * 删除装卸台信息
     */
    @PreAuthorize("@ss.hasPermi('basic:platform:remove')")
    @Log(title = "装卸台信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(platformInfoService.deletePlatformInfoByIds(ids));
    }
}
